﻿namespace YourLastOptionsDialog.ViewModels.Options
{
    /// <summary>
    /// An option for a password, derived from the string option.
    /// Note: The input scope property of the string option has no meaning and is ignored.
    /// </summary>
    public class PasswordOption : StringOption
    {
        private bool _showConfirmation;
        private string _confirmationPassword;
        private string _confirmationDescription;
        private string _passwordsDoNotMatchErrorMessage;

        /// <summary>
        /// Gets or sets a value indicating whether to show a second editor for confirmation,
        /// typically when the user is supposed to use this to change their existing password.
        /// </summary>
        /// <value>
        /// <c>true</c> if a confirmation should be shown; otherwise, <c>false</c>.
        /// </value>
        public bool ShowConfirmation
        {
            get
            {
                return _showConfirmation;
            }

            set
            {
                if (_showConfirmation != value)
                {
                    _showConfirmation = value;
                    RaisePropertyChanged("ShowConfirmation");
                }
            }
        }

        /// <summary>
        /// Gets or sets the confirmation password.
        /// </summary>
        public string ConfirmationPassword
        {
            get
            {
                return _confirmationPassword;
            }

            set
            {
                if (_confirmationPassword != value)
                {
                    _confirmationPassword = value;
                    RaisePropertyChanged("ConfirmationPassword");
                }
            }
        }

        /// <summary>
        /// Gets or sets the password confirmation description.
        /// </summary>
        public string ConfirmationDescription
        {
            get
            {
                return _confirmationDescription;
            }

            set
            {
                if (_confirmationDescription != value)
                {
                    _confirmationDescription = value;
                    RaisePropertyChanged("ConfirmationDescription");
                }
            }
        }

        /// <summary>
        /// Gets or sets the passwords don't match error message.
        /// </summary>
        public string PasswordsDoNotMatchErrorMessage
        {
            get
            {
                return _passwordsDoNotMatchErrorMessage;
            }

            set
            {
                if (_passwordsDoNotMatchErrorMessage != value)
                {
                    _passwordsDoNotMatchErrorMessage = value;
                    RaisePropertyChanged("PasswordsDoNotMatchErrorMessage");
                }
            }
        }
    }
}